package Code.Test5;

public class PhoneTest {
    public static void main(String[] args) {

        Phone[] arr = new Phone[3];

        Phone p1 = new Phone("vivo",1300,"白色");
        Phone p2 = new Phone("华为",2799,"蓝色");
        Phone p3 = new Phone("apple",8299,"黑色");
        arr[0] = p1;
        arr[1] = p2;
        arr[2] = p3;

        double sum = 0;
        for (int i = 0; i < arr.length; i++) {
            sum += arr[i].getPrice();
        }

        System.out.println("平均价格为："+(sum/  arr.length));
    }
}
